import { Component, OnInit, ViewChild } from '@angular/core';
import { GoodsMarklistGridComponent } from './goods-marklist-grid/goods-marklist-grid.component';
import { masterService } from '../../../../lib/master.service';

@Component({
  selector: 'goods-marklist',
  templateUrl: './goods-marklist.component.html',
  styleUrls: ['./goods-marklist.component.css'],
})
export class GoodsMarkListComponent implements OnInit {
  @ViewChild('markGrid') private markGrid: GoodsMarklistGridComponent;
  // 搜索传参的对象
  public searchModel:any = {
    goodsSn:'',
    goodsName:'',
    startTime:'',
    endTime:'',
    pageSize:10,
    pageIndex:1
  };

  public options: Array<any> = [];

  constructor(private _masterService:masterService) { }

  public ngOnInit():void { }

  // 过滤grid数据
  public selectListItem() {
    this.markGrid.onChangeTable(this.searchModel, '1');
  }

  openModal(){
    this._masterService.createMarkList.emit();
  }

  // 确定添加后刷新表格
  AddGoodsMarkFunc() {
    this.markGrid.onChangeTable(this.searchModel, '1');
    this.searchModel = {
        goodsSn:'',
        goodsName:'',
        startTime:'',
        endTime:'',
        pageSize:10,
        pageIndex:1
    }
  }
}
